fix: context ring always opens context stats panel - #156
Merged
jeonghun-jj-lee merged 1 commit intoAug 9, 2026
Conversation
Two bugs prevented the circular ring from reliably switching to the
context stats tab:
1. session-context-usage: contextVisible used a local tabState.activeTab()
derived from createSessionTabs with a missing review accessor. When the
active tab was 'review', the fallback logic returned 'context' if it was
still in all(), causing the ring to close instead of open. Fixed by
reading tabs().active() directly.
2. session-side-panel: the context Tabs.Trigger was gated behind
<Show when={contextOpen()}>, which unmounts the trigger when context is
closed. When openSessionTab simultaneously adds 'context' to all and
sets active='context', Kobalte processes the value change before the
Show mounts the trigger, so it can't find it. Fixed by replacing Show
with display:none on a wrapper div — the trigger stays registered with
Kobalte at all times.
Added a test exercising the close-then-reopen cycle to verify the state
transforms produce the correct activeTab at each step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Clicking the circular context-stats ring while on the file changes tab sometimes failed to switch to the context stats panel.
Root Causes
1. Wrong toggle detection (
session-context-usage.tsx)contextVisibleused a localtabState.activeTab()derived fromcreateSessionTabswith a missingreviewaccessor. When the real active tab was "review", the fallback logic incorrectly returned "context" (if it was still inall()), causing the ring to close context instead of opening it.Fix: Read
tabs().active()directly from the store.2. Kobalte trigger registration timing (
session-side-panel.tsx)The context
Tabs.Triggerwas gated behind<Show when={contextOpen()}>. WhenopenSessionTabsimultaneously adds "context" toalland setsactive="context", Kobalte processes thevalueprop change before theShowmounts the trigger element — it can't find it, so nothing switches.Fix: Replace
<Show>withdisplay: noneon a wrapper div. The trigger stays registered with Kobalte at all times; it just becomes visible when context is open.Test
Added a test exercising the close → reopen cycle, confirming the state transforms produce the correct
activeTab()at each step.